/*
 * @Author: lll 1280388921@qq.com
 * @Date: 2025-06-13 19:09:46
 * @LastEditors: lll 1280388921@qq.com
 * @LastEditTime: 2025-06-13 23:57:00
 * @FilePath: /lesson42/udp/Terminal.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <iostream>
#include <unistd.h>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

using namespace std;

string terminal = "/dev/pts/0"; 

int OpenTerm()
{
    int fd = open(terminal.c_str(), O_WRONLY);
    if (fd < 0)
    {
        cerr << "open terminal error" << endl;
        return 1;
    }
    dup2(fd, 2);

    return 0;
}